---
description: "Reference for Nitric's v0 .NET library - Retrieves the value from a version of a secret."
---

# .NET - Secret.Version.Access()

Retrieves the value from a version of a secret.

```csharp
using Nitric.Sdk;
using Nitric.Sdk.Resource;

var keyRef = Nitric.Secret("apiKey").With(SecretPermission.Accessing);

var keyValue = keyRef.Latest().Access();

keyValue.ValueText;

Nitric.Run();
```

## Examples

### Access the latest version of a secret

```csharp
using Nitric.Sdk;
using Nitric.Sdk.Resource;

var keyRef = Nitric.Secret("apiKey").With(SecretPermission.Accessing);

var keyValue = keyRef.Latest().Access();

keyValue.ValueText;

Nitric.Run();
```

### Access a specific version of a secret

```csharp
using Nitric.Sdk;
using Nitric.Sdk.Resource;

var keyRef = Nitric.Secret("apiKey").With(SecretPermission.Accessing);

var keyValue = keyRef.Version("the-version-id").Access();

keyValue.ValueText;

Nitric.Run();
```
